jq(function(){
	jq.getJSON("ProductServlet1","opr=show",callBack)
	function callBack(data){
		var  medestable=jq("#medestable").empty();
		
		medestable.append("<tr align=\"center\"><td width=\"230px\">商品名称</td> <td  width=\"220px\">商品图片</td><td  width=\"140px\">库存</td><td  width=\"140px\">价格</td> <td  colspan=\"2\"  width=\"180px\">操作 </td></tr>")
		var pro =data.productList
		for(var i=0;i<pro.length;i++){
			medestable.append("<tr align=\"center\"><td width=\"230px\">"+pro[i].name+"</td> <td  width=\"220px\">"+pro[i].fileName+"</td><td  width=\"140px\">"+pro[i].stock+"</td><td  width=\"140px\">"+pro[i].price+"</td> <td  width=\"90px\"><a href=\"MemberProductLevelServlet?opr=showProduct&id="+pro[i].id+"\">修改</a> </td><td  width=\"90px\"><a href=\"javascript:;\">删除</a> </td></tr>")
			
		}
		medestable.append("<a href=\"javascript:;\" id=\"1\" class=\"fenye\">首页</a>")
		for(var j=1;j<data.totalPageCount;j++){
			medestable.append("<a href=\"javascript:;\" id=\""+j+"\" class=\"fenye\">"+j+"</a>")
		}
			
		
		medestable.append("<a href=\"javascript:;\" id=\""+(data.currentPageNumber+1)+"\" class=\"fenye\">下一页</a>")
		medestable.append("<a href=\"javascript:;\" id=\""+data.totalPageCount+"\" class=\"fenye\">尾页</a>")
	}
	jq("#medestable").on("click",".fenye",function(){
		var currNo=this.id;
		jq.getJSON("ProductServlet1","opr=show&currNo="+currNo,callBack) 
		
		
	})
})